package com.bw.paper.entity;

import com.bw.paper.mvp.base.model.BaseEntity;
import com.google.gson.Gson;

import org.json.JSONArray;
import org.json.JSONException;

import java.util.ArrayList;
import java.util.List;

/**
 * {\"author_name\":\"编辑1\",
 * \"author_attestation\":\"人民日报\",
 * \"author_value\":\"测试编辑人员1\",
 * \"author_img\":\"664600719.jpg\",\"author_id\":1,\"channel_id\":1}
 * */

public class UserFollowEntity extends BaseEntity {
    public String values;

    public List<Values> getValues() {
        if (values == null)
            return null;
        List<Values>list = new ArrayList<>();
        try {
            JSONArray jsonArray = new JSONArray(values);
            for (int i = 0;i < jsonArray.length();i ++ ){
                String str = jsonArray.getString(i);
                Values entity = new Gson().fromJson(str,Values.class);
                list.add(entity);
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return list;
    }

    public static class Values{
        public String author_name;
        public String author_attestation;
        public String author_value;
        public String author_img;
        public long author_id;
        public long channel_id;
    }

}